package structure.flyweight;

/**
 * Created by lie on 2017/11/2.
 */
public class Test {

    public static void main(String[] args){
        PhoneGoods apple = GoodsFactory.getPhoneGoods("apple");
        PhoneGoods apple2 = GoodsFactory.getPhoneGoods("apple");
        PhoneGoods apple3 = GoodsFactory.getPhoneGoods("apple");
        apple.showGoodsPriceByVersion("64");
        apple2.showGoodsPriceByVersion("128");
        apple3.showGoodsPriceByVersion("128");

//        创建新phoneGoods对象,key为：name = apple
//        使用缓存,key为：name = apple
//        使用缓存,key为：name = apple
//        64G的要5199元
//        128G的要6199元
//        128G的要6199元

    }
}
